package com.example.yoho.mvp.model;

import com.example.lib_core.mvp.model.BaseModel;
import com.example.lib_core.network.RetrofitManager;
import com.example.yoho.mvp.contract.HomeContract;
import com.example.yoho.mvp.model.entity.BannerEntity;
import com.example.yoho.mvp.model.entity.HomeGoodsEntity;
import com.example.yoho.mvp.model.entity.RecommendEntity;
import com.example.yoho.mvp.model.entity.UpgradeEntity;

import javax.inject.Inject;

import io.reactivex.Observable;

public class HomeModel extends BaseModel implements HomeContract.Model {
    @Inject
    public HomeModel() {
    }

    @Override
    public Observable<BannerEntity> bannerModel() {
        return RetrofitManager.getInstance().getRetrofit().create(AppApi.class).bannerRequest();
    }

    @Override
    public Observable<RecommendEntity> recommendModel(String request) {
        return RetrofitManager
                .getInstance()
                .getRetrofit()
                .create(AppApi.class)
                .recommendRequest(request);
    }

    @Override
    public Observable<HomeGoodsEntity> homegoodsModel(String request) {
        return RetrofitManager.getInstance().getRetrofit().create(AppApi.class).goodsRequest(request);
    }

    @Override
    public Observable<UpgradeEntity> upgradeModel(String request) {
        return RetrofitManager.getInstance().getRetrofit().create(AppApi.class).upgradeRequest(request);
    }
}
